package CartService

import (
	"context"
	"gdshop-font-api-go/app/request/CartReq"
	"gdshop-font-api-go/library/response"
	toolsDb "gdshop-font-api-go/library/tools/db"
	"github.com/gogf/gf/frame/g"
)

func ChangePromotion(ctx context.Context, parames *CartReq.ChangePromotion) *response.JsonResponse {
	_, err := toolsDb.GetUnSafaTableAddDeleteWhere(ctx, "member_cart").Where("id", parames.Id).
		Where("member_id", parames.MemberId).Update(g.Map{
		"activity_id": parames.ActivityId,
	})
	if err != nil {
		return response.FailByRequestMessage(nil, err.Error())
	}

	return response.SuccessByRequestMessage(nil, "成功")
}
